package com.web.exiaodao.business.entity;

import com.web.webstart.base.entity.BaseEntity;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 * @author eason
 * @ClassName: User
 * @Description: 用户定义表
 * @date 2015年3月23日 下午1:00:00
 */
@Entity
@Table(name = "tb_xa_user")
@ApiModel(value = "用户定义表")
public class User extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户名,用户名，昵称")
    private String userName;
    @ApiModelProperty(value = "密码,密码")
    private String password;
    @NotNull
    @ApiModelProperty(value = "手机号,手机号")
    private String mobile;
    @ApiModelProperty(value = "头像,头像;单张图片")
    private String photo;
    @ApiModelProperty(value = "备注,备注memo")
    private String memo;
    @ApiModelProperty(value = "生日,生日;yyyy-MM-dd")
    private String birthday;
    @ApiModelProperty(value = "支付密码,支付密码，6存数字，要进行加密")
    private String payPassword;
    @ApiModelProperty(value = "推荐人,推荐人手机号")
    private String recommendPhone;
    @ApiModelProperty(value = "支付宝账号,绑定的支付宝账号")
    private String alipayAccount;
    @ApiModelProperty(value = "账户余额,余额")
    private Double balance;
    @ApiModelProperty(value = "是否是vip用户,是否是vip用户")
    private Boolean vip;
    @ApiModelProperty(value = "vip订单号码,vip订单号码")
    private String vipOrderNo;
    @ApiModelProperty(value = "email,邮箱")
    private String email;

    public User() {
    }

    public User(String mobile) {
        this.mobile = mobile;
    }


    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Column(nullable = true, length = 50)
    public String getUserName() {
        return userName;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Column(nullable = true, length = 50)
    public String getPassword() {
        return password;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    @Column(nullable = true, length = 11)
    public String getMobile() {
        return mobile;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    @Column(nullable = true, length = 50)
    public String getPhoto() {
        return photo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    @Column(nullable = true, length = 50)
    public String getMemo() {
        return memo;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    @Column(nullable = true, length = 50)
    public String getBirthday() {
        return birthday;
    }

    public void setPayPassword(String payPassword) {
        this.payPassword = payPassword;
    }

    @Column(nullable = true, length = 50)
    public String getPayPassword() {
        return payPassword;
    }

    @Column(nullable = true, length = 11)
    public String getRecommendPhone() {
        return recommendPhone;
    }

    public void setRecommendPhone(String recommendPhone) {
        this.recommendPhone = recommendPhone;
    }

    public String getAlipayAccount() {
        return alipayAccount;
    }

    public void setAlipayAccount(String alipayAccount) {
        this.alipayAccount = alipayAccount;
    }

    @Column(nullable = true, length = 50)
    public Double getBalance() {
        return balance == null ? 0 : balance;
    }

    public void setBalance(Double balance) {
        this.balance = balance;
    }

    @Column(nullable = true, length = 50)
    public Boolean getVip() {
        return vip;
    }

    @Column(nullable = true, length = 50)
    public String getVipOrderNo() {
        return vipOrderNo;
    }

    public void setVipOrderNo(String vipOrderNo) {
        this.vipOrderNo = vipOrderNo;
    }

    public void setVip(Boolean vip) {
        this.vip = vip;
    }

    @Column(nullable = true, length = 50)
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public void setInsertBefore() {
        super.setInsertBefore();
        if (balance == null) {
            balance = Double.parseDouble("0");
        }
    }
}
